package com.PAT.UnSatisfying;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/02/14/22:00
 * @Description:
 * @Target: 差4
 */
public class 宇宙无敌加法器 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String ss1 = in.nextLine();
        String ss2 = in.nextLine();
        String ss3 = in.nextLine();
        if (ss2.length()<ss1.length()){
            ss2 = AddZero(ss1.length()-ss2.length())+ss2;
        }

        if (ss3.length()<ss1.length()){
            ss3 = AddZero(ss1.length()-ss3.length())+ss3;
        }


        int sum = 0;
        int TempStore = 0;
        int count = 0;

        for (int i = ss1.length()-1; i >= 0 ; i--) {
            int c = 0;
            int a = ss2.charAt(i)-'0';
            int b = ss3.charAt(i)-'0';
            if (ss1.charAt(i)=='0'||ss1.charAt(i)=='d'){
                c = 10;
            }else {
                c = ss1.charAt(i)-'0';
            }
            if (a+b+TempStore>=c){

                sum = sum+((a+b+TempStore)%c)*(int)Math.pow(10,count);
                count++;
                TempStore = (a+b+TempStore)/c;
            }else {
                sum = sum+(a+b+TempStore)*(int)Math.pow(10,count);
                count++;
                TempStore = 0;

            }
        }


        if (TempStore!=0){
            sum = sum+TempStore*(int)Math.pow(10,count);
            System.out.print(sum);
        }else {
            System.out.println(sum);
        }


    }


    static String AddZero(int n){
        String ss = "";
        for (int i = 0; i < n; i++) {
            ss+="0";
        }

        return ss;
    }
}
